<script type="module">
	{
		let x = 1;
		let y = 2;
		
		document.write(`模板字符串计算x+y：${x+y}<br><br>`);
		
		function fn() {
			return "Hello World";
		}
		document.write(`模板字符串之中调用函数：${fn()}<br><br>`);
			
		document.write(`原样输出大括号内的字符串：${'大括号内的字符串'}<br><br>`);
			
		// 模板字符串嵌套
		const tmpl = addrs => `
			<table border='1'>
				${addrs.map(addr => `<tr><td>${addr.first}</td><td>${addr.last}</td></tr>`).join('')}
			</table>
		`;
		const data = [
		    { first: '模板字符串嵌套一', last: '模板字符串嵌套一' },
		    { first: '模板字符串嵌套二', last: '模板字符串嵌套二' },
		];
		
		document.write(`模板字符串嵌套：${tmpl(data)}<br><br>`);
	}
</script>